package edu.nctu.csie.jichang.dp.structural;

public class ProxyStatic {
	public static void main(String[] args) {
		PClass p = new PClass();
		p.doExecute();
		ProxyClass proxy = new ProxyClass(p);
		proxy.doExecute();
	}
}
interface ProxyInterface{
	void doExecute();
}
class PClass implements ProxyInterface{
	public void doExecute() {System.out.println("do execute");	}
}
class ProxyClass implements ProxyInterface{
	ProxyInterface p;
	ProxyClass(ProxyInterface p){this.p = p;}
	public void doExecute() {
		System.out.println("Proxy execute before");
		p.doExecute();
		System.out.println("Proxy execute after");
	}
}